<!DOCTYPE html>
<html>
<head>
    <title>生产成本</title>
    <#include "/header.html">
    <style>
        .el-table td, .el-table th {
            padding: 1px;
        }

        .el-table th {
            color: #0a8ddf;
        }

        .el-table .cell, .el-table th {
            padding-left: 1px;
            padding-right: 1px;

        }

        .el-table {
            font-size: 2px;

        }

        .demo-table-expand label {
            /*width: 90px;*/
            color: #0a8ddf;
        }

        .demo-table-expand .el-form-item {
            margin-right: 0;
            margin-bottom: 0;
            width: 15%;
        }

    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <!--查询开始-->
    <el-row>
        <el-col :span="8">
            <div class="grid-content bg-purple">
                <span style="color: #0a8ddf">订单类型</span>
                <el-radio-group v-model="q.producerType" @change="query">
                    <el-radio :label="''" style="padding-left: 0px;margin-left: 10px">全部</el-radio>
                    <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">紫云外协商</el-radio>
                    <el-radio :label="2" style="padding-left: 0px;margin-left: 10px">自营门店</el-radio>
                    <el-radio :label="3" style="padding-left: 0px;margin-left: 10px">小B</el-radio>
                    <el-radio :label="4" style="padding-left: 0px;margin-left: 10px">报价工厂</el-radio>
                    <!--<el-radio :label="9">备选项</el-radio>-->
                </el-radio-group>
            </div>
        </el-col>
        <el-col :span="6">
            <div class="grid-content bg-purple">
                <span style="color: #0a8ddf">提现方式</span>
                <el-radio-group v-model="q.onlineCash" @change="query">
                    <el-radio :label="''" style="padding-left: 0px;margin-left: 10px">全部</el-radio>
                    <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">线上</el-radio>
                    <el-radio :label="0" style="padding-left: 0px;margin-left: 10px">线下</el-radio>
                </el-radio-group>
            </div>
        </el-col>
        <el-col :span="8">
            <div class="grid-content bg-purple">
                <span style="color: #0a8ddf">财务审核</span>
                <el-radio-group v-model="q.financeStatus" @change="query">
                    <el-radio :label="''" style="padding-left: 0px;margin-left: 10px">全部</el-radio>
                    <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">待审核</el-radio>
                    <el-radio :label="2" style="padding-left: 0px;margin-left: 10px">待付款</el-radio>
                    <el-radio :label="3" style="padding-left: 0px;margin-left: 10px">已付款</el-radio>
                    <!--<el-radio :label="11" style="padding-left: 0px;margin-left: 10px">作废</el-radio>-->
                </el-radio-group>
            </div>
        </el-col>
    </el-row>
    <br>
    <el-row>
        <el-col :span="8">
            <div class="grid-content bg-purple">
                <span style="color: #0a8ddf">生产状态</span>
                <el-radio-group v-model="q.productionStatus" @change="query">
                    <el-radio :label="''" style="padding-left: 0px;margin-left: 10px">全部</el-radio>
                    <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">待生产</el-radio>
                    <el-radio :label="2" style="padding-left: 0px;margin-left: 10px">生产中</el-radio>
                    <el-radio :label="3" style="padding-left: 0px;margin-left: 10px">生产完成</el-radio>
                    <!--<el-radio :label="4" style="padding-left: 0px;margin-left: 10px">取消</el-radio>-->
                </el-radio-group>
            </div>
        </el-col>
        <el-col :span="6">
            <div class="grid-content bg-purple">
                <span style="color: #0a8ddf">成本录入</span>
                <el-radio-group v-model="q.costStatus" @change="query">
                    <el-radio :label="''" style="padding-left: 0px;margin-left: 10px">全部</el-radio>
                    <el-radio :label="1" style="padding-left: 0px;margin-left: 10px;">已录入</el-radio>
                    <el-radio :label="0" style="padding-left: 0px;margin-left: 10px">未录入</el-radio>
                </el-radio-group>
            </div>
        </el-col>
        <el-col :span="8">
            <div class="grid-content bg-purple">
                <span style="color: #0a8ddf">外协总费用:</span>
                &nbsp;&nbsp;&nbsp;&nbsp;<span
                    style="color:red;font-size: 18px; font-weight: bold;">{{totalPrice}} 元</span>
            </div>
        </el-col>
    </el-row>
    <br>
    <el-form :inline="true" class="demo-form-inline" size="small">
        <el-form-item>
            <el-input v-model.trim="q.orderNo" placeholder="订单号" style="width: 160px;" clearable></el-input>
        </el-form-item>
        <el-form-item>
            <el-input v-model.trim="q.producerName" placeholder="供应商名称" style="width: 160px;" clearable></el-input>
        </el-form-item>
        <el-form-item>
            <el-select v-model="q.sellerId" placeholder="订单来源" style="width: 160px;" clearable>
                <el-option v-for="item in sellerInfoList" :key="item.sellerId"
                           :label="item.sellerName" :value="item.sellerId">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item :inline="true">
            <el-input v-model="q.beginCost" placeholder="生产成本" style="width: 100px;" clearable></el-input>
            至
            <el-input v-model="q.endCost" placeholder="生产成本" style="width: 100px;" clearable></el-input>
        </el-form-item>
        <el-form-item>
            <el-date-picker v-model="q.beginCreatetime" type="datetime"
                            placeholder="选择下单时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss">
            </el-date-picker>
        </el-form-item>
        <el-form-item>
            <el-date-picker v-model="q.endCreatetime" type="datetime"
                            placeholder="下单结束时间" default-time="23:59:59" value-format="yyyy-MM-dd HH:mm:ss">
            </el-date-picker>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" icon="el-icon-search" @click="query" plain size="small">查询</el-button>&nbsp;&nbsp;&nbsp;&nbsp;
            <el-button type="primary" @click="reset" plain size="small">重 置</el-button>&nbsp;&nbsp;&nbsp;&nbsp;
            <el-button type="danger" @click="batchEnteringCost" plain size="small">批量录入</el-button>&nbsp;&nbsp;&nbsp;&nbsp;
            <el-button type="danger" @click="batchPayment" plain size="small">批量付款</el-button>&nbsp;&nbsp;&nbsp;&nbsp;
            <el-button type="danger" @click="batchAudit" plain size="small">批量审核</el-button>
        </el-form-item>
    </el-form>
    <!--查询结束-->

    <!--首页开始-->
    <template>
        <el-table border ref="multipleTable" :data="erpOrderProduction" tooltip-effect="dark">
            <el-table-column type="selection" width="50" align="center"></el-table-column>
            <el-table-column label="操作" align="center" style="width: 135px;">
                <template slot-scope="scope">
                    <a href="javascript:;" @click="enteringCost(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==0 && scope.row.financeStatus==1 ">录入成本 |</a>
                    <a href="javascript:;" @click="dead(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==0 && scope.row.financeStatus==1 ">作废 |</a>
                    <a href="javascript:;" @click="Trial(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==0 && scope.row.financeStatus==1 ">审核</a>
                    <a href="javascript:;" @click="payment(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==0 && scope.row.financeStatus==2 ">付款 |</a>
                    <a href="javascript:;" @click="withdraw(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==0 && scope.row.financeStatus==2 ">撤回</a>
                    <a href="javascript:;" @click="review(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==0 && scope.row.financeStatus==3 ">复审</a>
                    <a href="javascript:;" @click="payment(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==1 && scope.row.producerType==2 && scope.row.financeStatus==2 ">付款
                        |</a>
                    <a href="javascript:;" @click="review(scope.$index, scope.row)"
                       v-show="scope.row.onlineCash==1 && scope.row.producerType==2 && scope.row.financeStatus==3 ">复审</a>
                </template>
            </el-table-column>
            <el-table-column label="展开" type="expand">
                <template slot-scope="props">
                    <el-form label-position="left" inline class="demo-table-expand" align="center">
                        <el-form-item label="商品ID:">
                            <span>{{ props.row.orderItemId }}</span>
                        </el-form-item>
                        <el-form-item label="商品名称:">
                            <span>{{ props.row.erpItemName }}</span>
                        </el-form-item>
                        <el-form-item label="规格属性:">
                            <span>{{ props.row.addon}}</span>
                        </el-form-item>
                        <el-form-item label="数量:">
                            <span>{{ props.row.nums }}</span>
                        </el-form-item>
                        <el-form-item label="单位:">
                            <span>{{ props.row.unit }}</span>
                        </el-form-item>
                    </el-form>
                </template>
            </el-table-column>
            <el-table-column prop="orderNo" label="订单号" align="center" width="125">
                <template slot-scope="scope">
                    <a href="javascript:;"
                       @click="productionCostDetail(scope.row.orderNo)">{{scope.row.orderNo}}</a>
                </template>
            </el-table-column>
            <el-table-column prop="orderCreatetime" label="下单时间" align="center" width="125"></el-table-column>
            <el-table-column prop="sellerName" label="来源" align="center"></el-table-column>
            <el-table-column prop="onlineCash" label="提现方式" align="center" width="65">
                <template slot-scope="scope">
                    <span v-show="scope.row.onlineCash==1">线上</span>
                    <span v-show="scope.row.onlineCash==0">线下</span>
                </template>
            </el-table-column>
            <el-table-column prop="cost" label="生产成本" align="center" width="100"></el-table-column>
            <el-table-column prop="createTime" label="分配时间" align="center" width="125"></el-table-column>
            <el-table-column prop="attributeName" label="工序" align="center" width="120"></el-table-column>
            <el-table-column prop="productionStatus" label="生产状态" align="center" width="80">
                <template slot-scope="scope">
                    <span v-show="scope.row.productionStatus==1">待生产</span>
                    <span v-show="scope.row.productionStatus==2">生产中</span>
                    <span v-show="scope.row.productionStatus==3">生产完成</span>
                    <span v-show="scope.row.productionStatus==4">取消</span>
                </template>
            </el-table-column>
            <el-table-column prop="producerName" label="生产商" align="center" width="150px;"></el-table-column>
            <el-table-column prop="costStatus" label="成本录入" align="center" width="70">
                <template slot-scope="scope">
                    <span v-show="scope.row.costStatus==0">未录入</span>
                    <span v-show="scope.row.costStatus==1" style="color:#2ac845">已录入</span>
                </template>
            </el-table-column>
            <el-table-column prop="financeStatus" label="财务状态" align="center" width="70">
                <template slot-scope="scope">
                    <span v-show="scope.row.financeStatus==1">待审核</span>
                    <span v-show="scope.row.financeStatus==2">待付款</span>
                    <span v-show="scope.row.financeStatus==3" style="color: #2ac845">已付款</span>
                    <span v-show="scope.row.financeStatus==11">作废</span>
                </template>
            </el-table-column>
            <el-table-column prop="financePaytime" label="财务付款时间" align="center" width="125"></el-table-column>
            <el-table-column prop="financeRemark" label="财务备注" align="center"></el-table-column>
            <el-table-column prop="updateName" label="操作员" align="center" width="90"></el-table-column>
            <el-table-column prop="productionOrder" label="三方单号" align="center" width="125"></el-table-column>
        </el-table>
        <div class="block" align="center">
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="page.currentPage"
                    :page-sizes="page.pageSizes"
                    :page-size="page.pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="page.total">
            </el-pagination>
        </div>

    </template>

    <!--首月结束-->
    <!-- 录入成本 -->
    <el-dialog title="录入成本" :visible.sync="costFormVisible" width="400px">
        <el-form ref="costFrom" :model="costFrom" label-width="60px">
            <el-form-item label="成本" prop="cost"
                          :rules="[ {required: true, message: '请输如大于 0 的数字', trigger: 'change'}]">
                <el-input type="number" v-model="costFrom.cost" placeholder="请输如大于 0 的数字"></el-input>
                <!-- <el-input-number   v-model="costFrom.cost" controls-position="right" :precision="3" :step="0.5" :min="0"
                style="width:260px;"></el-input-number> -->
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="costFormVisible=false" size="small">取消</el-button>
            <el-button type="primary" @click="costFormConfrim('costFrom')" size="small">确 定</el-button>
        </div>
    </el-dialog>
    <!--录入成本end  -->

    <!-- 订单作废start -->
    <el-dialog title="订单作废" :visible.sync="deadFormVisible" width="400px">
        <el-form ref="deadFrom" :model="deadFrom" label-width="80px">
            <el-form-item label="订单备注" prop="financeRemark"
                          :rules="[ {required: true, message: '请输入订单作废备注', trigger: 'change'}]">
                <el-input type="textarea" maxLength="200" placeholder="请输入备注内容，200字以内" v-model="deadFrom.financeRemark" size="small" clearable></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="resetFrom('deadFrom')" size="small">重置</el-button>
            <el-button type="primary" @click="deadFormConfrim('deadFrom')" size="small">确 定</el-button>
        </div>
    </el-dialog>
    <!-- 订单作废end -->

    <!--付款start  -->
    <el-dialog title="付款" :visible.sync="paymentFormVisible" width="450px">
        <el-form ref="payFrom" :model="payFrom" label-width="80px">

            <el-form-item label="付款金额:">
                <span style="margin-left: 30px;color: red;font-size: 18px;font-weight:bold "> {{payFrom.cost}} 元</span>
            </el-form-item>

            <el-form-item label="付款时间" label-width="80px" prop="financePaytime"
                          :rules="[{ required: true, message: '请选择时间', trigger: 'change'}]">
                <el-date-picker type="datetime" v-model="payFrom.financePaytime" :default-value="new Date()"
                                placeholder="选择日期时间" style="width: 330px;">
                </el-date-picker>
            </el-form-item>

            <el-form-item label="付款备注" prop="financeRemark"
                          :rules="[ {required: true, message: '请输入付款备注', trigger: 'change'}]">
                <el-input type="textarea" maxLength="200" placeholder="请输入备注内容，200字以内" v-model="payFrom.financeRemark" clearable></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="resetFrom('payFrom')" size="small">重置</el-button>
            <el-button type="primary" @click="paymentForm('payFrom')" size="small">确 定</el-button>
        </div>
    </el-dialog>
    <!--付款end  -->
</div>

<!--订单详情页面-->
<#include "/modules/finance/productionCostDetail.html">
<script src="${request.contextPath}/statics/js/modules/finance/orderProductCost.js?_${.now?long}"></script>

</body>
</html>